import org.zjx.core.SocketConfig;
import org.zjx.server.ClusterServer;
import org.zjx.server.ServiceRegistry;
import org.zjx.service.AddService;
import org.zjx.service.HelloService;
import org.zjx.service.impl.AddServiceImpl;
import org.zjx.service.impl.HelloServiceImpl;

public class ServerDemo {
    public static void main(String[] args) {

        new Thread(() -> {
            SocketConfig masterConfig = new SocketConfig();
            masterConfig.setPort(8888);
            masterConfig.setDebugEnabled(true);


            ClusterServer master = new ClusterServer(masterConfig,
                    ClusterServer.ServerType.MASTER, null, 0);

            master.registerHandler(new AddHandler());

            // 主服务器先注册一些服务
            master.getServiceRegistry().registerService(HelloService.class, new HelloServiceImpl());
            master.getServiceRegistry().registerService(AddService.class, new AddServiceImpl());
            master.start();




        }).start();

    }
}
